<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>第三节：WXML语法 | 微信小程序</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-si-jie-ff1a-wxss-yu-fa.html" />
    
    
    <link rel="prev" href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-er-jie-ff1a-wxml-yu-fa.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="2.3"
        data-chapter-title="第三节：WXML语法"
        data-filepath="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-san-jie-ff1a-wxml-yu-fa.md"
        data-basepath=".."
        data-revision="Tue Feb 12 2019 17:48:38 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="chapter1.html">
            
                
                    <a href="../chapter1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        第一章：小程序前奏
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="chapter1/di-yi-jie-ff1a-ren-shi-xiao-cheng-xu.html">
            
                
                    <a href="../chapter1/di-yi-jie-ff1a-ren-shi-xiao-cheng-xu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        第一节：认识小程序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="chapter1/di-er-jie-ff1a-zhun-bei-gong-zuo.html">
            
                
                    <a href="../chapter1/di-er-jie-ff1a-zhun-bei-gong-zuo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        第二节：准备工作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="chapter1/di-san-jie-ff1a-kai-fa-gong-ju-jie-shao.html">
            
                
                    <a href="../chapter1/di-san-jie-ff1a-kai-fa-gong-ju-jie-shao.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        第三节：开发工具介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="chapter1/di-liu-jie-ff1a-wxss-yu-fa.html">
            
                
                    <a href="../chapter1/di-liu-jie-ff1a-wxss-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        第六节：WXSS语法
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo.html">
            
                
                    <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        第二章：小程序基础
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-yi-jie-ff1a-kuang-jia-jie-shao.html">
            
                
                    <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-yi-jie-ff1a-kuang-jia-jie-shao.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        第一节：项目结构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-er-jie-ff1a-wxml-yu-fa.html">
            
                
                    <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-er-jie-ff1a-wxml-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        第二节：配置
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="2.3" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-san-jie-ff1a-wxml-yu-fa.html">
            
                
                    <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-san-jie-ff1a-wxml-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        第三节：WXML语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-si-jie-ff1a-wxss-yu-fa.html">
            
                
                    <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-si-jie-ff1a-wxss-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        第五节：事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-liu-jie-ff1a-wxss-yu-fa.html">
            
                
                    <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-liu-jie-ff1a-wxss-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        第六节：WXSS语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-qi-jie-ff1a-flex-bu-ju.html">
            
                
                    <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-qi-jie-ff1a-flex-bu-ju.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        第七节：flex布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-bajie-ff1a-app-sheng-ming-zhou-qi.html">
            
                
                    <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-bajie-ff1a-app-sheng-ming-zhou-qi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        第八节：APP对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-jiu-jie-ff1a-page-dui-xiang.html">
            
                
                    <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-jiu-jie-ff1a-page-dui-xiang.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        第九节：Page对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-shi-zhang-ff1a-wxs-yu-fa.html">
            
                
                    <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-shi-zhang-ff1a-wxs-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        第十节：WXS语法
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="di-san-zhang-ff1a-chang-yong-zu-jian.html">
            
                
                    <a href="../di-san-zhang-ff1a-chang-yong-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        第三章：常用组件
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-yi-jie-ff1a-shi-tu-rong-qi-zu-jian.html">
            
                
                    <a href="../di-san-zhang-ff1a-chang-yong-zu-jian/di-yi-jie-ff1a-shi-tu-rong-qi-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        第一节：scroll-view组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-er-jieff1a-swiper-zu-jian.html">
            
                
                    <a href="../di-san-zhang-ff1a-chang-yong-zu-jian/di-er-jieff1a-swiper-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        第二节：swiper组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-san-jie-ff1a-movable-view-zu-jian.html">
            
                
                    <a href="../di-san-zhang-ff1a-chang-yong-zu-jian/di-san-jie-ff1a-movable-view-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        第三节：movable-view组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-sijie-ff1a-icon-zu-jian.html">
            
                
                    <a href="../di-san-zhang-ff1a-chang-yong-zu-jian/di-sijie-ff1a-icon-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        第四节：icon组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-wu-jie-ff1a-text-zu-jian.html">
            
                
                    <a href="../di-san-zhang-ff1a-chang-yong-zu-jian/di-wu-jie-ff1a-text-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        第五节：text组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/di-liu-jie-ff1a-input-zu-jian.html">
            
                
                    <a href="../di-san-zhang-ff1a-chang-yong-zu-jian/di-liu-jie-ff1a-input-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        第六节：input组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="di-san-zhang-ff1a-chang-yong-zu-jian/zi-ding-yi-zu-jian.html">
            
                
                    <a href="../di-san-zhang-ff1a-chang-yong-zu-jian/zi-ding-yi-zu-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        自定义组件
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" >
            
            <span><b>4.</b> 第四章：小程序API</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="di-yi-jie-ff1a-wang-luo-qing-qiu-api.html">
            
                
                    <a href="../di-yi-jie-ff1a-wang-luo-qing-qiu-api.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        第一节：网络请求API
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="di-liu-zhang-ff1a-es6-yu-fa.html">
            
                
                    <a href="../di-liu-zhang-ff1a-es6-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        第五章：ES6语法
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="di-liu-zhang-ff1a-es6-yu-fa/di-yi-jie-ff1a-shi-yao-shi-es6-yu-fa.html">
            
                
                    <a href="../di-liu-zhang-ff1a-es6-yu-fa/di-yi-jie-ff1a-shi-yao-shi-es6-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        第一节：什么是ES6语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="di-liu-zhang-ff1a-es6-yu-fa/di-er-jie-ff1a-es6-yu-fa.html">
            
                
                    <a href="../di-liu-zhang-ff1a-es6-yu-fa/di-er-jie-ff1a-es6-yu-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        第二节：定义变量
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="di-liu-zhang-ff1a-es6-yu-fa/di-san-jie-ff1a-han-shu.html">
            
                
                    <a href="../di-liu-zhang-ff1a-es6-yu-fa/di-san-jie-ff1a-han-shu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        第三节：函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="di-liu-zhang-ff1a-es6-yu-fa/di-si-jie-ff1a-lei.html">
            
                
                    <a href="../di-liu-zhang-ff1a-es6-yu-fa/di-si-jie-ff1a-lei.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        第四节：类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="di-liu-zhang-ff1a-es6-yu-fa/di-wu-jie-ff1a-mo-kuai.html">
            
                
                    <a href="../di-liu-zhang-ff1a-es6-yu-fa/di-wu-jie-ff1a-mo-kuai.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        第五节：模块
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="di-wu-zhang-ff1a-yun-kai-fa.html">
            
                
                    <a href="../di-wu-zhang-ff1a-yun-kai-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        第六章：云开发
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="di-yi-jie-ff1a-shi-yao-shi-yun-kai-fa.html">
            
                
                    <a href="../di-yi-jie-ff1a-shi-yao-shi-yun-kai-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        第一节：什么是云开发
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="di-er-jie-ff1a-zhu-ce-wei-xin-xiao-cheng-xu.html">
            
                
                    <a href="../di-er-jie-ff1a-zhu-ce-wei-xin-xiao-cheng-xu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        第二节：注册微信小程序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="di-san-jie-ff1a-kai-tong-yun-kai-fa.html">
            
                
                    <a href="../di-san-jie-ff1a-kai-tong-yun-kai-fa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        第三节：开通云开发
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="di-si-jie-ff1a-shu-ju-ku.html">
            
                
                    <a href="../di-si-jie-ff1a-shu-ju-ku.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        第四节：数据库准备
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="di-wu-jie-ff1a-shu-ju-ku-cao-zuo.html">
            
                
                    <a href="../di-wu-jie-ff1a-shu-ju-ku-cao-zuo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.</b>
                        
                        第五节：数据库操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="di-liu-jie-ff1a-command-zhi-ling.html">
            
                
                    <a href="../di-liu-jie-ff1a-command-zhi-ling.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.</b>
                        
                        第六节：command指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.7" data-path="di-qi-jie-ff1a-gao-ji-cha-xun.html">
            
                
                    <a href="../di-qi-jie-ff1a-gao-ji-cha-xun.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.</b>
                        
                        第七节：高级查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.8" data-path="di-ba-jie-ff1a-wen-jian-shang-chuan.html">
            
                
                    <a href="../di-ba-jie-ff1a-wen-jian-shang-chuan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.8.</b>
                        
                        第八节：文件操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.9" data-path="di-jiu-jie-ff1a-node-huan-jing-da-jian.html">
            
                
                    <a href="../di-jiu-jie-ff1a-node-huan-jing-da-jian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.9.</b>
                        
                        第九节：node环境搭建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.10" data-path="di-shi-jie-ff1a-yun-han-shu.html">
            
                
                    <a href="../di-shi-jie-ff1a-yun-han-shu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.10.</b>
                        
                        第十节：云函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.11" data-path="di-shi-yi-jie-ff1a-yun-han-shu-jian-ce-nei-rong-an-quan.html">
            
                
                    <a href="../di-shi-yi-jie-ff1a-yun-han-shu-jian-ce-nei-rong-an-quan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.11.</b>
                        
                        第十一节：检测内容安全
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.12" data-path="di-shi-er-jie-ff1a-yun-han-shu-tu-pian-jian-huang.html">
            
                
                    <a href="../di-shi-er-jie-ff1a-yun-han-shu-tu-pian-jian-huang.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.12.</b>
                        
                        第十二节：图片鉴黄
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.13" data-path="di-shi-san-jie-ff1a-yong-hu-shou-quan.html">
            
                
                    <a href="../di-shi-san-jie-ff1a-yong-hu-shou-quan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.13.</b>
                        
                        第十三节：用户授权
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.14" data-path="di-shi-si-jie-ff1a-qi-ta-shou-quan-fang-shi.html">
            
                
                    <a href="../di-shi-si-jie-ff1a-qi-ta-shou-quan-fang-shi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.14.</b>
                        
                        第十四节：其他授权方式
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >微信小程序</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="wxml&#x8BED;&#x6CD5;">WXML&#x8BED;&#x6CD5;</h1>
<p>&#x5FAE;&#x4FE1;&#x5B98;&#x65B9;&#x6559;&#x7A0B;&#x5982;&#x4E0B;&#xFF1A;<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxml/" target="_blank">https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxml/</a></p>
<h2 id="&#x7279;&#x70B9;&#xFF1A;">&#x7279;&#x70B9;&#xFF1A;</h2>
<ol>
<li>&#x5E03;&#x5C40;&#x7684;&#x65B9;&#x5F0F;&#x8DDF;HTML&#x662F;&#x4E00;&#x6A21;&#x4E00;&#x6837;&#x7684;&#x3002;</li>
<li>&#x6807;&#x7B7E;&#x7684;&#x540D;&#x5B57;&#x4E0D;&#x518D;&#x662F;&#x4F20;&#x7EDF;&#x7684;HTML&#x7684;&#x4E86;&#xFF0C;&#x800C;&#x662F;&#x4F7F;&#x7528;&#x5FAE;&#x4FE1;&#x81EA;&#x5DF1;&#x5B9A;&#x4E49;&#x7684;&#x4E00;&#x5957;&#xFF0C;&#x6240;&#x4EE5;&#x5199;&#x4EE3;&#x7801;&#x7684;&#x65F6;&#x5019;&#x5B8C;&#x5168;&#x4F7F;&#x7528;&#x4E4B;&#x524D;&#x5199;HTML&#x7684;&#x65B9;&#x5F0F;&#x53BB;&#x5199;&#xFF0C;&#x53EA;&#x4E0D;&#x8FC7;&#x6539;&#x4E2A;&#x6807;&#x7B7E;&#x540D;&#x5C31;&#x53EF;&#x4EE5;&#x4E86;&#x3002;</li>
<li>WXML&#x7684;&#x8BED;&#x6CD5;&#xFF0C;&#x548C;&#x4E00;&#x4E9B;&#x6A21;&#x677F;&#x8BED;&#x6CD5;&#x6BD4;&#x5982;Django&#x4E2D;&#x7684;&#x6A21;&#x677F;&#x8BED;&#x6CD5;&#x975E;&#x5E38;&#x7684;&#x7C7B;&#x4F3C;&#x3002;</li>
</ol>
<h2 id="&#x53D8;&#x91CF;&#x6E32;&#x67D3;&#xFF1A;">&#x53D8;&#x91CF;&#x6E32;&#x67D3;&#xFF1A;</h2>
<ol>
<li>&#x4F7F;&#x7528;&#x53CC;&#x5927;&#x82B1;&#x62EC;&#x53F7;&#x3002;</li>
<li>&#x83B7;&#x53D6;&#x5BF9;&#x8C61;&#x7684;&#x503C;&#xFF0C;&#x901A;&#x8FC7;&#x4E0B;&#x6807;&#x83B7;&#x53D6;&#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x503C;&#x3002;</li>
<li>&#x53EF;&#x4EE5;&#x505A;&#x8FD0;&#x7B97;&#xFF0C;&#x6BD4;&#x5982;&#x5224;&#x65AD;&#xFF0C;&#x56DB;&#x5219;&#x8FD0;&#x7B97;&#x7B49;&#x3002;</li>
<li>&#x603B;&#x800C;&#x8A00;&#x4E4B;&#x4E00;&#x53E5;&#x8BDD;&#xFF1A;&#x9700;&#x8981;&#x4F7F;&#x7528;js&#x4E2D;&#x4F20;&#x8FC7;&#x6765;&#x7684;&#x503C;&#xFF0C;&#x5C31;&#x5FC5;&#x987B;&#x4F7F;&#x7528;&#x53CC;&#x5927;&#x82B1;&#x62EC;&#x53F7;&#x3002;</li>
</ol>
<h2 id="&#x6761;&#x4EF6;&#x6E32;&#x67D3;&#xFF1A;">&#x6761;&#x4EF6;&#x6E32;&#x67D3;&#xFF1A;</h2>
<ol>
<li>&#x5728;&#x6307;&#x5B9A;&#x7684;&#x6807;&#x7B7E;&#x4E2D;&#x4F7F;&#x7528;<code>wx:if=&quot;&#x6761;&#x4EF6;&quot;</code>&#xFF0C;&#x5982;&#x679C;&#x6761;&#x4EF6;&#x6210;&#x7ACB;&#xFF0C;&#x5219;&#x4F1A;&#x6E32;&#x67D3;&#x8FD9;&#x4E2A;&#x6807;&#x7B7E;&#x3002;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;<pre><code class="lang-wxml"> <view wx:if="{{age &gt; 18}}">
     &#x8FDB;&#x5165;&#x7F51;&#x5427;
 </view>
</code></pre>
</li>
<li><p><code>else</code>&#x548C;<code>elif</code>&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x5728;<code>if</code>&#x4E0B;&#x9762;&#x4F7F;&#x7528;&#x3002;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-wxml"> <view wx:if="{{weather == &apos;&#x6674;&#x5929;&apos;}}">
     &#x51FA;&#x53BB;&#x65C5;&#x6E38;
 </view>
 <view wx:elif="{{weather == &apos;&#x9634;&#x5929;&apos;}}">
     &#x53BB;&#x901B;&#x8857;
 </view>
 <view wx:else="">
     &#x54EA;&#x91CC;&#x90FD;&#x4E0D;&#x53BB;
 </view>
</code></pre>
<p><strong>&#x6CE8;&#x610F;&#xFF1A;elif&#x548C;else&#x53EA;&#x80FD;&#x8DDF;&#x5728;if&#x540E;&#x9762;&#xFF0C;&#x5426;&#x5219;&#x4F1A;&#x62A5;&#x9519;</strong></p>
</li>
<li><p>&#x5982;&#x679C;&#x9700;&#x8981;&#x901A;&#x8FC7;&#x6761;&#x4EF6;&#x6765;&#x5224;&#x65AD;&#x662F;&#x5426;&#x9700;&#x8981;&#x6E32;&#x67D3;&#x4E00;&#x7EC4;&#x6807;&#x7B7E;&#xFF0C;&#x90A3;&#x4E48;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>block</code>&#x3002;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-wxml"> <block wx:if="{{weather == &apos;&#x6674;&#x5929;&apos;}}">
     <view>
         &#x51FA;&#x53BB;&#x65C5;&#x6E38;
     </view>
 </block>
 <block wx:elif="{{weather == &apos;&#x9634;&#x5929;&apos;}}">
     <view>
         &#x53BB;&#x901B;&#x8857;
     </view>
 </block>
 <block wx:else="">
     <view>
         &#x54EA;&#x91CC;&#x90FD;&#x4E0D;&#x53BB;
     </view>
 </block>
</code></pre>
</li>
</ol>
<h2 id="&#x5217;&#x8868;&#x6E32;&#x67D3;&#xFF1A;">&#x5217;&#x8868;&#x6E32;&#x67D3;&#xFF1A;</h2>
<ol>
<li>&#x901A;&#x8FC7;&#x8BED;&#x6CD5;<code>wx:for=&quot;{{&#x5217;&#x8868;}}&quot;</code>&#x6765;&#x6E32;&#x67D3;&#x4E00;&#x4E2A;&#x5217;&#x8868;&#x3002;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;<pre><code class="lang-wxml"> <view wx:for="{{[1,2,3,4]}}">
     {{item}}    
 </view>
</code></pre>
</li>
<li>&#x5FAA;&#x73AF;&#x4E2D;&#xFF0C;&#x9ED8;&#x8BA4;&#x7684;&#x4E0B;&#x6807;&#x540D;&#x79F0;&#x662F;<code>index</code>&#xFF0C;&#x9ED8;&#x8BA4;&#x7684;&#x503C;&#x7684;&#x540D;&#x79F0;&#x662F;<code>item</code>&#x3002;&#x5982;&#x679C;&#x60F3;&#x8981;&#x4FEE;&#x6539;&#x5FAA;&#x73AF;&#x5217;&#x8868;&#x7684;&#x503C;&#x548C;&#x4E0B;&#x6807;&#x7684;&#x540D;&#x79F0;&#xFF0C;&#x90A3;&#x4E48;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;<code>wx:for-index</code>&#x548C;<code>wx:for-item</code>&#x6765;&#x6307;&#x5B9A;&#x3002;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;<pre><code class="lang-wxml"> <view wx:for="{{[1,2,3,4]}}" wx:for-index="idx" wx:for-item="value">
     {{index}}/{{value}}    
 </view>
</code></pre>
</li>
<li>&#x5982;&#x679C;&#x60F3;&#x8981;&#x5728;&#x5FAA;&#x73AF;&#x4E2D;&#x6E32;&#x67D3;&#x591A;&#x4E2A;&#x6807;&#x7B7E;&#xFF0C;&#x90A3;&#x4E48;&#x4E5F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;<code>block</code>&#x6765;&#x5B9E;&#x73B0;&#x3002;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;<pre><code class="lang-wxml"> <block wx:for="{{[1,2,3,4]}}">
     <view>{{index}}</view>
     <view>{{item}}</view>
 </block>
</code></pre>
</li>
</ol>
<h2 id="&#x4E5D;&#x4E5D;&#x4E58;&#x6CD5;&#x8868;&#x6848;&#x4F8B;&#xFF1A;">&#x4E5D;&#x4E5D;&#x4E58;&#x6CD5;&#x8868;&#x6848;&#x4F8B;&#xFF1A;</h2>
<p><img src="../assets/&#x4E5D;&#x4E5D;&#x4E58;&#x6CD5;&#x8868;.jpg" alt=""></p>
<p>wxml&#x6587;&#x4EF6;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-title">view</span> <span class="hljs-attribute">wx:for</span>=<span class="hljs-value">&quot;{{[1, 2, 3, 4, 5, 6, 7, 8, 9]}}&quot;</span> <span class="hljs-attribute">wx:for-index</span>=<span class="hljs-value">&quot;index1&quot;</span> <span class="hljs-attribute">wx:for-item</span>=<span class="hljs-value">&quot;row&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&apos;row&apos;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">view</span> <span class="hljs-attribute">wx:for</span>=<span class="hljs-value">&quot;{{[1, 2, 3, 4, 5, 6, 7, 8, 9]}}&quot;</span> <span class="hljs-attribute">wx:for-index</span>=<span class="hljs-value">&quot;index2&quot;</span> <span class="hljs-attribute">wx:for-item</span>=<span class="hljs-value">&quot;col&quot;</span> <span class="hljs-attribute">wx:if</span>=<span class="hljs-value">&quot;{{col &lt;= row}}&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&apos;col&apos;</span>&gt;</span>
      {{col}}*{{row}}={{row*col}}
    <span class="hljs-tag">&lt;/<span class="hljs-title">view</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">view</span>&gt;</span>
</code></pre>
<p>wxssw&#x6587;&#x4EF6;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-css"><span class="hljs-class">.row</span><span class="hljs-rules">{
  <span class="hljs-rule"><span class="hljs-attribute">display</span>:<span class="hljs-value"> flex</span></span>;
  <span class="hljs-rule"><span class="hljs-attribute">justify-content</span>:<span class="hljs-value"> start</span></span>;
  <span class="hljs-rule"><span class="hljs-attribute">font-size</span>:<span class="hljs-value"> <span class="hljs-number">10px</span></span></span>;
}</span>

<span class="hljs-class">.row</span> <span class="hljs-class">.col</span><span class="hljs-rules">{
  <span class="hljs-rule"><span class="hljs-attribute">width</span>:<span class="hljs-value"> <span class="hljs-number">40px</span></span></span>;
}</span>
</code></pre>
<h2 id="wxkey&#x4F5C;&#x7528;&#xFF1A;">wx:key&#x4F5C;&#x7528;&#xFF1A;</h2>
<p>&#x5982;&#x679C;&#x5217;&#x8868;&#x4E2D;&#x9879;&#x76EE;&#x7684;&#x4F4D;&#x7F6E;&#x4F1A;&#x52A8;&#x6001;&#x6539;&#x53D8;&#x6216;&#x8005;&#x6709;&#x65B0;&#x7684;&#x9879;&#x76EE;&#x6DFB;&#x52A0;&#x5230;&#x5217;&#x8868;&#x4E2D;&#xFF0C;&#x5E76;&#x4E14;&#x5E0C;&#x671B;&#x5217;&#x8868;&#x4E2D;&#x7684;&#x9879;&#x76EE;&#x4FDD;&#x6301;&#x81EA;&#x5DF1;&#x7684;&#x7279;&#x5F81;&#x548C;&#x72B6;&#x6001;&#xFF08;&#x5982; <code>&lt;input/&gt;</code> &#x4E2D;&#x7684;&#x8F93;&#x5165;&#x5185;&#x5BB9;&#xFF0C;<code>&lt;switch/&gt;</code> &#x7684;&#x9009;&#x4E2D;&#x72B6;&#x6001;&#xFF09;&#xFF0C;&#x9700;&#x8981;&#x4F7F;&#x7528; wx:key &#x6765;&#x6307;&#x5B9A;&#x5217;&#x8868;&#x4E2D;&#x9879;&#x76EE;&#x7684;&#x552F;&#x4E00;&#x7684;&#x6807;&#x8BC6;&#x7B26;&#x3002;</p>
<p>wx:key &#x7684;&#x503C;&#x4EE5;&#x4E24;&#x79CD;&#x5F62;&#x5F0F;&#x63D0;&#x4F9B;&#xFF1A;</p>
<ol>
<li>&#x5B57;&#x7B26;&#x4E32;&#x6216;&#x8005;&#x6570;&#x5B57;&#xFF0C;&#x4EE3;&#x8868;&#x5728; for &#x5FAA;&#x73AF;&#x7684; array &#x4E2D; item &#x7684;&#x67D0;&#x4E2A; property&#xFF0C;&#x8BE5; property &#x7684;&#x503C;&#x9700;&#x8981;&#x662F;&#x5217;&#x8868;&#x4E2D;&#x552F;&#x4E00;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x6216;&#x6570;&#x5B57;&#xFF0C;&#x4E14;&#x4E0D;&#x80FD;&#x52A8;&#x6001;&#x6539;&#x53D8;&#x3002;<strong>&#x5728;&#x5199;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x76F4;&#x63A5;&#x5199;&#x8FD9;&#x4E2A; property &#x7684;&#x540D;&#x5B57;&#x5C31;&#x53EF;&#x4EE5;&#x4E86;&#xFF0C;&#x4E0D;&#x9700;&#x8981;&#x5199;</strong><code>item.property</code><strong>&#x7684;&#x5F62;&#x5F0F;&#xFF0C;&#x5E76;&#x4E14;&#x4E0D;&#x9700;&#x8981;&#x52A0;&#x4E2D;&#x62EC;&#x53F7;&#x3002;</strong></li>
<li><p>&#x4FDD;&#x7559;&#x5173;&#x952E;&#x5B57; <em>this &#x4EE3;&#x8868;&#x5728; for &#x5FAA;&#x73AF;&#x4E2D;&#x7684; item &#x672C;&#x8EAB;&#xFF0C;&#x8FD9;&#x79CD;&#x8868;&#x793A;&#x9700;&#x8981; item &#x672C;&#x8EAB;&#x662F;&#x4E00;&#x4E2A;&#x552F;&#x4E00;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x6216;&#x8005;&#x6570;&#x5B57;&#xFF0C;&#x5982;&#xFF1A;<br>&#x5F53;&#x6570;&#x636E;&#x6539;&#x53D8;&#x89E6;&#x53D1;&#x6E32;&#x67D3;&#x5C42;&#x91CD;&#x65B0;&#x6E32;&#x67D3;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F1A;&#x6821;&#x6B63;&#x5E26;&#x6709; key &#x7684;&#x7EC4;&#x4EF6;&#xFF0C;*&#x6846;&#x67B6;&#x4F1A;&#x786E;&#x4FDD;&#x4ED6;&#x4EEC;&#x88AB;&#x91CD;&#x65B0;&#x6392;&#x5E8F;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x91CD;&#x65B0;&#x521B;&#x5EFA;</em>&#xFF0C;&#x4EE5;&#x786E;&#x4FDD;&#x4F7F;&#x7EC4;&#x4EF6;&#x4FDD;&#x6301;&#x81EA;&#x8EAB;&#x7684;&#x72B6;&#x6001;&#xFF0C;&#x5E76;&#x4E14;&#x63D0;&#x9AD8;&#x5217;&#x8868;&#x6E32;&#x67D3;&#x65F6;&#x7684;&#x6548;&#x7387;&#x3002;</p>
</li>
<li><p>&#x53CA;&#x65F6;&#x5217;&#x8868;&#x4E2D;&#x7684;&#x7EC4;&#x4EF6;&#x6CA1;&#x6709;&#x53D1;&#x751F;&#x72B6;&#x6001;&#x6539;&#x53D8;&#xFF0C;&#x90A3;&#x4E48;&#x4E5F;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528;<code>wx:key</code>&#x3002;&#x56E0;&#x4E3A;&#x5982;&#x679C;&#x4E0D;&#x4F7F;&#x7528;&#xFF0C;&#x90A3;&#x4E48;&#x4EE5;&#x540E;&#x91CD;&#x65B0;&#x6E32;&#x67D3;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5C31;&#x4F1A;&#x628A;&#x4E4B;&#x524D;&#x7EC4;&#x4EF6;&#x9500;&#x6BC1;&#x6389;&#xFF0C;&#x7136;&#x540E;&#x91CD;&#x65B0;&#x521B;&#x5EFA;&#xFF0C;&#x6027;&#x80FD;&#x4F1A;&#x5F88;&#x4F4E;&#x3002;</p>
</li>
</ol>
<p>&#x5982;&#x4E0D;&#x63D0;&#x4F9B; wx:key&#xFF0C;&#x4F1A;&#x62A5;&#x4E00;&#x4E2A; warning&#xFF0C; &#x5982;&#x679C;&#x660E;&#x786E;&#x77E5;&#x9053;&#x8BE5;&#x5217;&#x8868;&#x662F;&#x9759;&#x6001;&#xFF0C;&#x6216;&#x8005;&#x4E0D;&#x5FC5;&#x5173;&#x6CE8;&#x5176;&#x987A;&#x5E8F;&#xFF0C;&#x53EF;&#x4EE5;&#x9009;&#x62E9;&#x5FFD;&#x7565;&#x3002;</p>
<h2 id="&#x6A21;&#x677F;&#xFF1A;">&#x6A21;&#x677F;&#xFF1A;</h2>
<p>&#x6709;&#x4E9B;&#x65F6;&#x5019;&#xFF0C;&#x4E00;&#x6BB5;&#x5E03;&#x5C40;&#x4EE3;&#x7801;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5728;&#x591A;&#x4E2A;&#x5730;&#x65B9;&#x4F7F;&#x7528;&#xFF0C;&#x90A3;&#x4E48;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5C06;&#x5176;&#x5B9A;&#x4E49;&#x6210;&#x6A21;&#x677F;&#xFF0C;&#x7136;&#x540E;&#x628A;&#x53D8;&#x91CF;&#x5355;&#x72EC;&#x62BD;&#x53D6;&#x51FA;&#x6765;&#xFF0C;&#x901A;&#x8FC7;&#x8C03;&#x7528;&#x6A21;&#x677F;&#x7684;&#x65F6;&#x5019;&#x518D;&#x4F20;&#x9012;&#x8FC7;&#x53BB;&#x3002;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-title">template</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">&quot;msgItem&quot;</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-title">view</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">text</span>&gt;</span> {{index}}: {{msg}} <span class="hljs-tag">&lt;/<span class="hljs-title">text</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">text</span>&gt;</span> Time: {{time}} <span class="hljs-tag">&lt;/<span class="hljs-title">text</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-title">view</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">template</span>&gt;</span>
</code></pre>
<p>&#x8C03;&#x7528;&#x6A21;&#x677F;&#xFF1A;</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-title">import</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;../../templates/msgItem.wxml&quot;</span> /&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">template</span> <span class="hljs-attribute">is</span>=<span class="hljs-value">&quot;msgItem&quot;</span> <span class="hljs-attribute">data</span>=<span class="hljs-value">&quot;{{index:1,msg:&quot;</span><span class="hljs-value">&#x4F60;&#x597D;&#xFF01;&#x6211;&#x662F;&#x77E5;&#x4E86;&#x8BFE;&#x5802;&#xFF01;&quot;,time:3000&#x5E74;10&#x6708;22&#x65E5;}}&quot;</span>/&gt;</span>
</code></pre>
<p>&#x5728;&#x4F20;&#x9012;&#x53D8;&#x91CF;&#x7684;&#x65F6;&#x5019;<a href="di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-san-jie-ff1a-wxml-yu-fa.md">&#x7B2C;&#x4E09;&#x8282;&#xFF1A;WXML&#x8BED;&#x6CD5;</a>&#xFF0C;&#x5982;&#x679C;&#x662F;&#x76F4;&#x63A5;&#x4ECE;js&#x6587;&#x4EF6;&#x4E2D;&#x83B7;&#x53D6;&#x5230;&#x7684;&#xFF0C;&#x90A3;&#x4E48;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;<code>...item</code>&#x7684;&#x65B9;&#x5F0F;&#x6765;&#x5C55;&#x5F00;&#x663E;&#x793A;&#x3002;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-js">Page({
    data: {
        message: {
            index: <span class="hljs-number">1</span>,
            msg: <span class="hljs-string">&apos;&#x4F60;&#x597D;&#xFF01;&#x6211;&#x662F;&#x77E5;&#x4E86;&#x8BFE;&#x5802;&#xFF01;&apos;</span>,
            time: <span class="hljs-string">&apos;2018&#x5E74;10&#x6708;22&#x65E5;&apos;</span>
        }
    }
});
</code></pre>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-title">import</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;../../templates/msgItem.wxml&quot;</span> /&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">template</span> <span class="hljs-attribute">is</span>=<span class="hljs-value">&quot;msgItem&quot;</span> <span class="hljs-attribute">data</span>=<span class="hljs-value">&quot;{{...message}}&quot;</span>/&gt;</span>
</code></pre>
<p>&#x53E6;&#x5916;&#xFF0C;&#x5982;&#x679C;&#x60F3;&#x4F7F;&#x7528;&#x6A21;&#x677F;&#x7684;&#x6837;&#x5F0F;&#x6587;&#x4EF6;&#xFF0C;&#x4E5F;&#x9700;&#x8981;&#x5728;<code>wxss</code>&#x6587;&#x4EF6;&#x4E2D;&#x5BFC;&#x5165;&#x6A21;&#x677F;&#x7684;<code>wxss</code>&#x6587;&#x4EF6;&#x3002;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-css"><span class="hljs-at_rule">@<span class="hljs-keyword">import</span> <span class="hljs-string">&quot;../../../templates/msgItem.wxss&quot;</span></span>;
</code></pre>
<h2 id="include&#xFF1A;">include&#xFF1A;</h2>
<p>&#x5982;&#x679C;&#x4E00;&#x6BB5;&#x4EE3;&#x7801;&#x662F;&#x4E0D;&#x9700;&#x8981;&#x586B;&#x5165;&#x52A8;&#x6001;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x90A3;&#x4E48;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x4F7F;&#x7528;<code>include</code>&#x628A;&#x8FD9;&#x6BB5;&#x4EE3;&#x7801;&#x5F15;&#x5165;&#x5230;&#x5176;&#x4ED6;&#x7684;&#x5730;&#x65B9;&#x3002;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;<br>header.html&#x4E2D;&#x7684;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-title">view</span>&gt;</span>
&#x8FD9;&#x662F;header.wxml&#x4E2D;&#x7684;&#x5185;&#x5BB9;
<span class="hljs-tag">&lt;/<span class="hljs-title">view</span>&gt;</span>
</code></pre>
<p>index.wxml&#x4E2D;&#x7684;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-title">include</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;header.wxml&quot;</span> /&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">view</span>&gt;</span>
&#x8FD9;&#x91CC;&#x662F;index.wxml&#x4E2D;&#x7684;&#x4EE3;&#x7801;
<span class="hljs-tag">&lt;/<span class="hljs-title">view</span>&gt;</span>
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-er-jie-ff1a-wxml-yu-fa.html" class="navigation navigation-prev " aria-label="Previous page: 第二节：配置"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../di-er-zhang-ff1a-kai-fa-zhun-bei-gong-zuo/di-si-jie-ff1a-wxss-yu-fa.html" class="navigation navigation-next " aria-label="Next page: 第五节：事件"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
